import loading from '@/components/xuan-loading/xuan-loading.vue'
import cLabel from "@/components/cat-label/cat-label.vue"
import fromItem from '@/components/from-item/from-item.vue'
import lsjUpload from '@/uni_modules/lsj-upload/components/lsj-upload/lsj-upload.vue';
import {
	log
} from 'util'
export default {
	props: {
		mustIcon: {
			type: String,
			default: require('@/static/Scope.png'),
		},
		unIcon: {
			type: String,
			default: require('@/static/unscope.png'),
		}
	},
	data() {

		return {
			Inv: 5,
			closeNum: -1, //闭合处置结果
			FirstNum: -1,
			SecondNum: -1,
			ThirdNum: -1,
			FourthNum: -1,
			handle1: ["同意", "不同意"],
			handle: ["留用", "废弃", "降级", "其他"],

			// 一级审核
			showPicker1: false,
			//一级审核

			// 二级审核
			showPicker2: false,
			//二级审核

			// 三级审核
			showPicker3: false,
			//三级审核

			// 四级审核
			showPicker4: false,
			//四级审核

			//文件上传
			uplosdDisabled: false,
			fPhotofilelist: [], //展示数列
			attachmentDetails: [],
			enclosureImg: {},

			dialogPdf: false,
			pdfUrl: "",
			fFileName: "",
			recordfiles: [], //删除合集
			// 弹框

			// 微信小程序Map对象for循环不显示，所以转成普通数组，不要问为什么，我也不知道
			size: 10,
			debug: true,
			instantly: true, // 选择文件后是否立即自动上传
			heights: '156rpx',
			count: 8,
			list: [],
			fileList: [], //文件
			fPhotofilelist: [], //处理过程相关资料
			flagNum: -1,
			option: {},




			// loading样式
			width: '150rpx',
			height: '100rpx',
			shadeShow: false,
			backgroundColor: "transparent",
			themeColor: '#33CCCC',
			// loading样式

			detailsNum: 0,
			userInfo: null, //当前登录用户
			timing: null, //当前年月日
			Fdata: {
				num: null,
			}, //上个页面传过来的参数
			totalData: {
				dischargeinfo: {
					fId: "", // fid
					fCompanyid: "", // 标段ID
					fCompanyname: "", // 标段名称
					fProjectid: "", // 项目ID
					fProjectname: "", // 项目名称
					fStatus: "",
					fNote: "",
					fIsdeleted: "",
					fBeamyardid: "", // 梁场ID
					fBeamyardname: "", // 梁场名称
					fBeamid: "", // 梁id
					fBeamname: "", // 梁名称
					fEngineeringid: "", // 工程部位id
					fEngineeringname: "", // 工程部位名称
					fMachineid: "", // 设备id
					fMachinename: "", // 设备名称
					fConcretedesignstrength: "", // 砼设计强度
					fWarninglevel: "", // 预警级别 正常 1级 2级 3级
					fAge: "", // 龄期
					fPouringdates: "", // 浇筑时间
					fTensioningdates: "", // 张拉日期
					fCreatedates: "", // 上传时间
				},
				closeinfo: {
					fCompanyid: "", // 施工标段id
					fId: "", // 申请单fid //为空判断为新增
					fParentid: "", // 对应的超标记录fid
					fWarningcontent: "", // 预警内容
					fReason: "", // 问题原因
					fHandleway: "", // 处理方式
					fHandleresult: "", // 处理结果
					fHandledate: "",
					fHandledates: "", // 处理日期
					fHandleusername: "", // 处理人名称
					fHandlefile: "", // 处理附件id
					fFirstcheckresult: "", // 一级审核处理结果
					fFirstcheckopinion: "", // 一级审核处理意见
					fFirstcheckusername: "", // 一级审核处理人name
					fFirstcheckdates: "", // 一级审核处理日期
					fSecondcheckresult: "", // 二级审核处理结果
					fSecondcheckopinion: "", // 二级审核处理意见
					fSecondcheckusername: "", // 二级审核处理人name
					fSecondcheckdates: "", // 二级审核处理日期
					fThirdcheckresult: "", // 三级审核处理结果
					fThirdcheckopinion: "", // 三级审核处理意见
					fThirdcheckusername: "", // 三级审核处理人name
					fThirdcheckdates: "", // 三级审核处理日期
					fFourthcheckresult: "", // 四级审核处理结果
					fFourthcheckopinion: "", // 四级审核处理意见
					fFourthcheckusername: "", // 四级审核处理人name
					fFourthcheckdates: "", // 四级审核处理日期

					aduitStatus: null, //保存状态
					userId: "", // 当前登录人id
					userName: "", // 当前登录人姓名
					recordfiles: [], // 删除文件id集合
				},
			},

			fileList: [], //删除文件

			activeNames: ["1"], //处理---折叠
			activeList: ["1"], //详情---折叠

			readonly0: false, //是否只读
			readonly1: false,
			readonly2: false,
			readonly3: false,
			readonly4: false,


			must0: "must", //必填
			must1: "must",
			must2: "must",
			must3: "must",
			must4: "must",

			currentDate: false, //年月日选择
			currentDate1: false, //年月日选择
			currentDate2: false, //年月日选择
			currentDate3: false, //年月日选择
			currentDate4: false, //年月日选择


			companyNum: null, //判断用户身份

			appliance: 0,
			btnShow: false,
		};
	},


	onReady() {

		this.$nextTick(() => {
			this.$refs.lsjUpload.show();
		})
		var that = this

		if (that.timestamp == "" && that.timestamp == null && that.timestamp ==
			undefined) {
			console.log("文件么准备好")
		} else {
			setTimeout(() => {

				uni.getStorage({
					key: 'userInfo',
					success: function(res) {
						that.userInfo = JSON.parse(res.data)
						var folderid = that.timestamp
						var userId = that.userInfo.userId
						var userName = that.userInfo.realName
						var url = that.$http.upload + '?folderid=' + folderid + '&userId=' +
							userId + '&userName=' +
							userName;
						that.option = {
							// 上传服务器地址，此地址需要替换为你的接口地址
							url: url,
							// 上传附件的key
							name: 'file',
							header: {},
							formData: {}
						};
					}
				})
			}, 3000)
		}
	},
	onLoad(options) {
		console.log(options.companyId);
		this.getFdata(JSON.parse(options.data));
		// this.getExamine(options.companyId, JSON.parse(options.data))
		this.getExamine(JSON.parse(options.data));
		uni.getStorage({ //监督检查方式
			key: 'userInfo',
			success: function(res) {
				this.userInfo = JSON.parse(res.data);
				console.log("this.userInfo", this.userInfo);
				// this.perusalList = this.userInfo.companyId;

			}
		});

		// || MP-WEIXIN || H5
		// #ifdef APP-PLUS
		this.playVideo()
		uni.$on('drawer-page', (data) => {
			that.clickNum(data)
		})
		// #endif
		// #ifdef H5
		this.appliance = 1
		// #endif

	},
	onShow() {

	},
	components: {
		loading,
		cLabel,
		lsjUpload,
		// cc,
		fromItem
	},

	onUnload() {
		uni.$off('drawer-page')
	},

	methods: {
		getFdata(data) {
			console.log("父传", data);
			this.Fdata = data;
			this.companyNum = this.Fdata.F_CheckStatus;
			this.Inv = this.Fdata.F_CheckStatus

			if (this.Fdata.F_CheckStatus == "0") {
				this.readonly0 = false;
				this.readonly1 = true;
				this.readonly2 = true;
				this.readonly3 = true;
				this.must0 = "must";
				this.must1 = "must";
				this.must2 = "must";
				this.must3 = "must";
				this.closeNum = -1;
				this.FirstNum = -1
				this.SecondNum = -1
				this.ThirdNum = -1

				this.activeNames = ["1"];
			} else if (this.Fdata.F_CheckStatus == "1") {
				this.readonly0 = true;
				this.readonly1 = false;
				this.readonly2 = true;
				this.readonly3 = true;
				this.must0 = "no";
				this.must1 = "must";
				this.must2 = "must";
				this.must3 = "must";
				this.closeNum = 0
				this.FirstNum = -1
				this.SecondNum = -1
				this.ThirdNum = -1


				this.activeNames = ["1", "2"];

			} else if (this.Fdata.F_CheckStatus == "2") {
				this.readonly0 = true;
				this.readonly1 = true;
				this.readonly2 = false;
				this.readonly3 = true;
				this.must0 = "no";
				this.must1 = "no";
				this.must2 = "must";
				this.must3 = "must";
				this.closeNum = 0
				this.FirstNum = 0
				this.SecondNum = -1
				this.ThirdNum = -1

				this.activeNames = ["1", "3"];
			} else if (this.Fdata.F_CheckStatus == "3") {
				this.readonly0 = true;
				this.readonly1 = true;
				this.readonly2 = true;
				this.readonly3 = false;
				this.must0 = "no";
				this.must1 = "no";
				this.must2 = "no";
				this.must3 = "must";
				this.FirstNum = 0
				this.closeNum = 0
				this.SecondNum = 0
				this.ThirdNum = -1

				this.activeNames = ["1", "4"];
			} else if (this.Fdata.F_CheckStatus == "4") {
				this.readonly0 = true;
				this.readonly1 = true;
				this.readonly2 = true;
				this.readonly3 = true;
				this.must0 = "no";
				this.must1 = "no";
				this.must2 = "no";
				this.must3 = "no";
				this.FirstNum = 0
				this.closeNum = 0
				this.SecondNum = 0
				this.ThirdNum = 0

				this.activeNames = ["1"];
			}

			this.getDetailData(this.Fdata.F_Id, 0);
		},
		// 获取审核流程v 
		getExamine(row) {
			var status = row.F_CheckStatus;
			this.$http.getStationWarnByCompanyId({
					companyId: row.F_CompanyId
				})
				.then((res) => {
					if (res.errcode == 0) {
						// F_WarningLevel

						this.AduitUser = res.data.yjQmpMsStationwarn;
						var text = 'fAduitUser' + row.F_WarningLevel; //获取当前用的审核流程

						// console.log(88, status, row.F_WarningLevel, this.AduitUser[text], this.userInfo.companyNature,this.AduitUser, row);
						var fAduitUser;
						if (this.AduitUser[text] != '----' || this.AduitUser[text] != null) {
							fAduitUser = this.AduitUser[text].split("-");
							var that = this;
							uni.getStorage({ //监督检查方式
								key: 'userInfo',
								success: function(res) {
									that.userInfo = JSON.parse(res.data);
									console.log("this.userInfo12", that.userInfo,fAduitUser[row.F_CheckStatus],that.userInfo.companyNature);
									if (fAduitUser[row.F_CheckStatus] == that.userInfo.companyNature) {
										that.Inv = row.F_CheckStatus;
										that.btnShow = true;
										if (status == 0) { // 闭合申请单 可编辑
											that.readonly0 = false;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;

											that.must0 = "must";
											that.must1 = "must";
											that.must2 = "must";
											that.must3 = "must";
											that.must4 = "must";

											that.closeNum = -1;
											that.FirstNum = -1
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;
											that.activeNames = ["1"];

										} else if (status == "1") {
											that.readonly0 = true;
											that.readonly1 = false;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "must";
											that.must2 = "must";
											that.must3 = "must";
											that.must4 = "must";
											that.closeNum = 0
											that.FirstNum = -1
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;
											that.activeNames = ["1", "2"];

										} else if (status == "2") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = false;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "must";
											that.must3 = "must";
											that.must4 = "must";
											that.closeNum = 0
											that.FirstNum = 0
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;

											that.activeNames = ["1", "3"];
										} else if (status == "3") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = false;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "must";
											that.must4 = "must";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = -1
											that.FourthNum = -1;

											that.activeNames = ["1", "4"];
										} else if (status == "4") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = false;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "no";
											that.must4 = "must";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = 0
											that.FourthNum = -1;

											that.activeNames = ["1"];
										} else {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "no";
											that.must4 = "no";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = 0
											that.FourthNum = 0;

											that.activeNames = ["1"];
										}
									} else {
										that.btnShow = false;
										console.log(77987, status);
										if (status == 0) { // 闭合申请单 可编辑
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;

											that.must0 = "no";
											that.must1 = "must";
											that.must2 = "must";
											that.must3 = "must";
											that.must4 = "must";

											that.closeNum = -1;
											that.FirstNum = -1
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;
											that.activeNames = ["1"];

										} else if (status == "1") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "must";
											that.must3 = "must";
											that.must4 = "must";
											that.closeNum = 0
											that.FirstNum = -1
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;
											that.activeNames = ["1", "2"];

										} else if (status == "2") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "must";
											that.must4 = "must";
											that.closeNum = 0
											that.FirstNum = 0
											that.SecondNum = -1
											that.ThirdNum = -1
											that.FourthNum = -1;

											that.activeNames = ["1", "3"];
										} else if (status == "3") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "no";
											that.must4 = "must";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = -1
											that.FourthNum = -1;

											that.activeNames = ["1", "4"];
										} else if (status == "4") {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "no";
											that.must4 = "no";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = 0
											that.FourthNum = -1;

											that.activeNames = ["1"];
										} else {
											that.readonly0 = true;
											that.readonly1 = true;
											that.readonly2 = true;
											that.readonly3 = true;
											that.readonly4 = true;
											that.must0 = "no";
											that.must1 = "no";
											that.must2 = "no";
											that.must3 = "no";
											that.must4 = "no";
											that.FirstNum = 0
											that.closeNum = 0
											that.SecondNum = 0
											that.ThirdNum = 0
											that.FourthNum = 0;

											that.activeNames = ["1"];
										}
									}
									// this.perusalList = this.userInfo.companyId;

								}
							});
						} else {
							fAduitUser = []
						}

						// F_CheckStatus
					}
				})
				.catch((error) => {
					console.log(error);
				});
		},


		// 闭合申请单
		Confirm(value) {
			this.totalData.closeinfo.fHandleresult = value;
			this.showPicker = false;
		},
		// 闭合申请单

		// 一级审核
		Confirm1(value) {
			this.totalData.closeinfo.fFirstcheckresult = value;
			this.showPicker1 = false;
		},
		// 一级审核

		// 二级审核
		Confirm2(value) {
			this.totalData.closeinfo.fSecondcheckresult = value;
			this.showPicker2 = false;
		},
		// 二级审核

		// 三级审核
		Confirm3(value) {
			this.totalData.closeinfo.fThirdcheckresult = value;
			this.showPicker3 = false;
		},


		onClickLeft() {
			this.$router.push({
				path: "TensionList",
			});
		},
		// 上传文件
		handleChange(res) {
			this.enclosureImg = new FormData(); //new一个formData事件
			this.enclosureImg.append("folderid", this.timestamp); //将file属性添加到formData里
			this.enclosureImg.append("file", res.raw); //将file属性添加到formData里
			this.enclosureImg.append("userId", this.userInfo.userId); //将file属性添加到formData里
			this.enclosureImg.append("userName", this.userInfo.realName); //将file属性添加到formData里
			upload(this.enclosureImg).then((i) => {
				i[0]["name"] = res.name;
				i[0]["url"] = res.url;
				this.fPhotofilelist.push(i[0]);
			});
		},
		// 预览
		openPdf(file) {
			// this.dialogPdf = true;

			this.pdfUrl = file.atta.fFilepath.replace(
				"C:",
				"http://1.14.103.201:8301"
			);
			this.fFileName = file.name;
			this.openPdfImg(this.pdfUrl, this.fFileName);
		},
		openPdfImg(url, name) {
			// this.dialogPdf = true;
			// this.pdfUrl = url;
			// this.fFileName = name;
			this.$router.push({
				path: "/pdf",
				query: {
					title: name,
					pathUrl: url
				}
			});
		},
		// 删除
		handleRemove(file) {
			this.$refs.upload.handleRemove(file);
			for (let index = 0; index < this.fPhotofilelist.length; index++) {
				if (file.uid == this.fPhotofilelist[index].uid) {
					// this.imgsFId.fId = this.fPhotofilelist[index].atta.fId;
					if (this.fPhotofilelist[index].atta == undefined) {
						this.recordfiles.push({
							fId: this.fPhotofilelist[index].fId,
						});
					} else {
						this.recordfiles.push({
							fId: this.fPhotofilelist[index].atta.fId,
						});
					}
					this.fPhotofilelist.splice(index, 1);
				}
			}
		},

		// 上传文件

		onClick(name) {
			this.detailsNum = name;
		},

		getDetailData(id, num) {

			this.getDate();
			var that = this;
			this.$http.getClosedFormByParentId({
					fId: id,
					fCompanyid: this.Fdata.F_CompanyId,
				})
				.then((res) => {
					if (res.errcode == 0) {
						that.fileList = [];
						that.totalData = res.data;
						if (that.totalData.dischargeinfo.fWarninglevel == "0") {
							that.totalData.dischargeinfo.fWarninglevel = "合格";
						} else if (
							that.totalData.dischargeinfo.fWarninglevel == "1"
						) {
							that.totalData.dischargeinfo.fWarninglevel = "不合格";
						}
// this.totalData.closeinfo.fHandledates=`${y}-${m}-${d}`
						if (num == "0") {
							if (that.totalData.closeinfo.fHandledates == null) {
								that.totalData.closeinfo.fHandledates = that.timing;
							}

							if (that.totalData.closeinfo.fFirstcheckdates == null) {
								that.totalData.closeinfo.fFirstcheckdates = that.timing;
							}

							if (that.totalData.closeinfo.fSecondcheckdates == null) {
								that.totalData.closeinfo.fSecondcheckdates = that.timing;
							}
							if (that.totalData.closeinfo.fThirdcheckdates == null) {
								that.totalData.closeinfo.fThirdcheckdates = that.timing;
							}
							if (that.totalData.closeinfo.fFourthcheckdates == null) {
								that.totalData.closeinfo.fFourthcheckdates = that.timing;
							}
						}

						// 文件
						that.timestamp = that.totalData.closeinfo.fHandlefile;
						that.fPhotofilelist = that.totalData.fSourcefileList;

						//上传文件
						this.vantLoading = false;
					} else {
						this.vantLoading = false;

						uni.showToast({
							title: res.msg,
							icon: 'none',
							duration: 2000
						});
						return false;
					}
				})
				.catch((error) => {
					this.vantLoading = false;
					uni.showToast({
						title: error,
						icon: 'none',
						duration: 2000
					});
					return false;
				});
		},

		formatDate(date) {
			return `${date.getFullYear()}-${(date.getMonth() + 1 + "").padStart(
			        2,
			        "0"
			      )}-${(date.getDate() + "").padStart(2, "0")}`;
		},
		onConfirm(date) {
			this.currentDate = false;
			this.totalData.closeinfo.fHandledates = this.formatDate(date);
		},
		onConfirm1(date) {
			this.currentDate1 = false;
			this.totalData.closeinfo.fFirstcheckdates = this.formatDate(date);
		},
		onConfirm2(date) {
			this.currentDate2 = false;
			this.totalData.closeinfo.fSecondcheckdates = this.formatDate(date);
		},
		onConfirm3(date) {
			this.currentDate3 = false;
			this.totalData.closeinfo.fThirdcheckdates = this.formatDate(date);
		},

		clickNum(data) {
			// if (data == "0") {
			// 保存按钮
			this.saveData();
			// }
		},
		onSubmit() {},
		// 判断必填项
		saveData() {
			var that = this;
			that.detailsNum = 1;
			console.log("判断必填项", that.totalData.closeinfo, that.companyNum);
			if (
				(that.totalData.closeinfo.fReason == "" ||
					that.totalData.closeinfo.fReason == undefined) &&
				that.companyNum == "0"
			) {
				uni.showToast({
					title: '闭合申请单 问题原因不能为空',
					icon: 'none',
					duration: 2000
				});
				return false;
			} else if (
				(that.totalData.closeinfo.fHandleway == "" ||
					that.totalData.closeinfo.fHandleway == undefined) &&
				that.companyNum == "0"
			) {
				uni.showToast({
					title: '闭合申请单 处理方式不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fHandleresult == "" ||
					that.totalData.closeinfo.fHandleresult == undefined) &&
				that.companyNum == "0"
			) {
				uni.showToast({
					title: '闭合申请单 处置结果不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fHandledates == "" ||
					that.totalData.closeinfo.fHandledates == undefined) &&
				that.companyNum == "0"
			) {
				uni.showToast({
					title: '闭合申请单 处理日期不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fHandleusername == "" ||
					that.totalData.closeinfo.fHandleusername == undefined) &&
				that.companyNum == "0"
			) {
				uni.showToast({
					title: '闭合申请单 处理人不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fFirstcheckresult == "" ||
					that.totalData.closeinfo.fFirstcheckresult == undefined) &&
				that.companyNum == "1"
			) {
				uni.showToast({
					title: '一级审核 处理结果不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fFirstcheckusername == "" ||
					that.totalData.closeinfo.fFirstcheckusername == undefined) &&
				that.companyNum == "1"
			) {
				uni.showToast({
					title: '一级审核 处理人不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fFirstcheckdates == "" ||
					that.totalData.closeinfo.fFirstcheckdates == undefined) &&
				that.companyNum == "1"
			) {
				uni.showToast({
					title: '一级审核 处理日期不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fSecondcheckresult == "" ||
					that.totalData.closeinfo.fSecondcheckresult == undefined) &&
				that.companyNum == "2"
			) {
				uni.showToast({
					title: '二级审核 处理结果不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fSecondcheckusername == "" ||
					that.totalData.closeinfo.fSecondcheckusername == undefined) &&
				that.companyNum == "2"
			) {
				uni.showToast({
					title: '二级审核 处理人不能为空',
					icon: 'none',
					duration: 2000
				});



				return false;
			} else if (
				(that.totalData.closeinfo.fSecondcheckdates == "" ||
					that.totalData.closeinfo.fSecondcheckdates == undefined) &&
				that.companyNum == "2"
			) {
				uni.showToast({
					title: '二级审核 处理日期不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fThirdcheckresult == "" ||
					that.totalData.closeinfo.fThirdcheckresult == undefined) &&
				that.companyNum == "3"
			) {
				uni.showToast({
					title: '三级审核 处理结果不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fThirdcheckusername == "" ||
					that.totalData.closeinfo.fThirdcheckusername == undefined) &&
				that.companyNum == "3"
			) {
				uni.showToast({
					title: '三级审核 处理人不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fThirdcheckdates == "" ||
					that.totalData.closeinfo.fThirdcheckdates == undefined) &&
				that.companyNum == "3"
			) {
				uni.showToast({
					title: '三级审核 处理日期不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else if (
				(that.totalData.closeinfo.fFourthcheckresult == "" ||
					that.totalData.closeinfo.fFourthcheckresult == undefined) &&
				that.companyNum == "4"
			) {
				uni.showToast({
					title: '四级审核 处理结果不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fFourthcheckusername == "" ||
					that.totalData.closeinfo.fFourthcheckusername == undefined) &&
				that.companyNum == "4"
			) {
				uni.showToast({
					title: '四级审核 处理人不能为空',
					icon: 'none',
					duration: 2000
				});


				return false;
			} else if (
				(that.totalData.closeinfo.fFourthcheckdates == "" ||
					that.totalData.closeinfo.fFourthcheckdates == undefined) &&
				that.companyNum == "4"
			) {
				uni.showToast({
					title: '四级审核 处理日期不能为空',
					icon: 'none',
					duration: 2000
				});

				return false;
			} else {
				that.clickN = 1
				let totalData1 = {
					fCompanyid: "", // 施工标段id
					fId: "", // 申请单fid //为空判断为新增
					fParentid: "", // 对应的超标记录fid
					fWarningcontent: "", // 预警内容
					fReason: "", // 问题原因
					fHandleway: "", // 处理方式
					fHandleresult: "", // 处理结果
					fHandledate: "",
					fHandledates: "", // 处理日期
					fHandleusername: "", // 处理人名称
					fHandlefile: "", // 处理附件id
					fFirstcheckresult: "", // 一级审核处理结果
					fFirstcheckopinion: "", // 一级审核处理意见
					fFirstcheckusername: "", // 一级审核处理人name
					fFirstcheckdates: "", // 一级审核处理日期
					fSecondcheckresult: "", // 二级审核处理结果
					fSecondcheckopinion: "", // 二级审核处理意见
					fSecondcheckusername: "", // 二级审核处理人name
					fSecondcheckdates: "", // 二级审核处理日期
					fThirdcheckresult: "", // 三级审核处理结果
					fThirdcheckopinion: "", // 三级审核处理意见
					fThirdcheckusername: "", // 三级审核处理人name
					fThirdcheckdates: "", // 三级审核处理日期
					fFourthcheckresult: "", // 四级审核处理结果
					fFourthcheckopinion: "", // 四级审核处理意见
					fFourthcheckusername: "", // 四级审核处理人name
					fFourthcheckdates: "", // 四级审核处理日期

					aduitStatus: null, //保存状态
					userId: "", // 当前登录人id
					userName: "", // 当前登录人姓名
					recordfiles: [], // 删除文件id集合
				};

				if (that.totalData.closeinfo.fId == null) {
					totalData1.fId = "";
				} else {
					totalData1.fId = that.totalData.closeinfo.fId;
				}
				totalData1.fCompanyid = this.Fdata.F_CompanyId;
				totalData1.aduitStatus = that.Fdata.F_CheckStatus;
				totalData1.fParentid = that.Fdata.F_Id;
				totalData1.fWarningcontent = that.totalData.closeinfo.fWarningcontent;
				totalData1.fReason = that.totalData.closeinfo.fReason;
				totalData1.fHandleway = that.totalData.closeinfo.fHandleway;
				totalData1.fHandleresult = that.totalData.closeinfo.fHandleresult;
				totalData1.fHandledates = that.totalData.closeinfo.fHandledates;
				totalData1.fHandleusername = that.totalData.closeinfo.fHandleusername;
				totalData1.fHandlefile = that.totalData.closeinfo.fHandlefile;

				totalData1.fFirstcheckresult =
					that.totalData.closeinfo.fFirstcheckresult;
				totalData1.fFirstcheckopinion =
					that.totalData.closeinfo.fFirstcheckopinion;
				totalData1.fFirstcheckusername =
					that.totalData.closeinfo.fFirstcheckusername;
				totalData1.fFirstcheckdates = that.totalData.closeinfo.fFirstcheckdates;

				totalData1.fSecondcheckresult =
					that.totalData.closeinfo.fSecondcheckresult;
				totalData1.fSecondcheckopinion =
					that.totalData.closeinfo.fSecondcheckopinion;
				totalData1.fSecondcheckusername =
					that.totalData.closeinfo.fSecondcheckusername;
				totalData1.fSecondcheckdates =
					that.totalData.closeinfo.fSecondcheckdates;

				totalData1.fThirdcheckresult =
					that.totalData.closeinfo.fThirdcheckresult;
				totalData1.fThirdcheckopinion =
					that.totalData.closeinfo.fThirdcheckopinion;
				totalData1.fThirdcheckusername =
					that.totalData.closeinfo.fThirdcheckusername;
				totalData1.fThirdcheckdates = that.totalData.closeinfo.fThirdcheckdates;


				totalData1.recordfiles = that.recordfiles; //删除文件的id

				this.$http.addClosedForm(totalData1)
					.then((res) => {
						if (res.errcode == 0) {
							that.$refs.loading.open();
							that.page = false
							if (!that.click) {
								setTimeout(() => {
									uni.showToast({
										title: "保存成功",
										icon: 'none',
										duration: 2000

									});
									uni.redirectTo({
										url: "/pages/apply/HntManage/testing/index?Inv=" +
											0,
										success: () => {
											that.clickN = 1
											that.click = false
											that.$refs.loading.close();
											// #ifdef H5
											setTimeout(() => {
												that.click = false
											}, 100)

											// #endif

										}

									})
								}, 1500)
							}
							that.click = true
						} else {
							uni.showToast({
								title: "保存失败",
								icon: 'none',
								duration: 2000
							});
							that.clickN = 0
							this.$refs.loading.close();
						}
					})

			}


		},

		// 获取当前日期
		getDate() {
			var time = new Date();
			const y = time.getFullYear();
			const m = (time.getMonth() + 1 + "").padStart(2, "0");
			const d = (time.getDate() + "").padStart(2, "0");
			//   const hh = (time.getHours() + "").padStart(2, "0");
			//   const mm = (time.getMinutes() + "").padStart(2, "0");
			//   const ss = (time.getSeconds() + "").padStart(2, "0");

			//   var timer = `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
			this.timing = `${y}-${m}-${d}`;
		},

		yj_searchForm(num) {
			var that = this
			this.Inv = num
		},

		//显示隐藏
		downUp(num) {
			if (num == 1) {
				this.basic = 2;
			} else {
				this.basic = 1;
			}
		},
		downUpConsumption(num) {
			if (num == 1) {
				this.consumption = 2;
			} else {
				this.consumption = 1;
			}
		},

		downUpClose(num) {
			if (num == 1) {
				this.close = 2;
			} else {
				this.close = 1;
			}
		},
		downUpAuditA(num) {
			if (num == 1) {
				this.auditA = 2;
			} else {
				this.auditA = 1;
			}
		},
		downUpAuditB(num) {
			if (num == 1) {
				this.auditB = 2;
			} else {
				this.auditB = 1;
			}
		},
		//显示隐藏



		pdfPage(name, url) {

			let links = encodeURIComponent(url)
			uni.navigateTo({
				url: '/pages/apply/pdf?links=' + links + '&names=' + name,
			})

		},
		// 删除文件
		DelFile(e, id, index) {
			var that = this
			uni.showModal({
				title: '召唤师',
				content: '确定要删除这段回忆吗？',
				cancelText: '再看看',
				confirmText: '再见',
				success: res => {
					if (res.confirm) {

						that.recordfiles.push({
							fId: id
						})
						this.fileList.splice(index, 1)
						// this.fileList.splice(e.currentTarget.dataset.index, 1)
					}
				}
			})
		},
		DelFilefRecheckfileList(e, id, index) {
			var that = this
			uni.showModal({
				title: '召唤师',
				content: '确定要删除这段回忆吗？',
				cancelText: '再看看',
				confirmText: '再见',
				success: res => {
					if (res.confirm) {

						that.recordfiles.push({
							fId: id
						})
						this.fPhotofilelist.splice(index, 1)
					}
				}
			})
		},


		// 上传进度回调
		onprogress(item) {
			if (item.responseText) {
				var data = JSON.parse(item.responseText)
				var url = data[0].atta.fFilepath
				var urlPath;
				if (url.indexOf(this.$http.redf) == -1) {
					urlPath = url.replace(this.$http.redf, this.$http.file)
				}
				this.fileList.push({
					url: urlPath,
					name: item.name,
					fId: data[0].atta.fId
				});

			}
		},
		onprogressfRecheckfileList(item) {
			if (item.responseText) {
				var data = JSON.parse(item.responseText)
				var url = data[0].atta.fFilepath
				var urlPath;
				if (url.indexOf(this.$http.redf) == -1) {
					urlPath = url.replace(this.$http.redf, this.$http.file)
				}
				this.fPhotofilelist.push({
					url: urlPath,
					name: item.name,
					fId: data[0].atta.fId
				});

			}
		},
		// 文件选择回调
		onChange(files) {},






		getNewData() {
			var that = this;
		},

		selectorFun(e) {
			console.log("下拉选择", e);
		},



		// 原生窗体按钮显示
		playVideo() {
			let subNVue = uni.getSubNVueById('safe_notice')
			subNVue.show()
		},


		callback() {}
	}
}
